The invention relates to the design and the implementation of operations within a user interface of a computer program.
Graphics-oriented computer programs often allow a user to create and manipulate many different kinds of data through a user interface. The user interface typically provides the capability to apply operations to a currently selected range or set of data, such as a copy or color setting operation. The processes for storing and selecting data often vary depending on the data type. For example, in a page layout program, the selection could be a range of text, specified internally by a start position and a length, or a set of graphics objects, such as lines, ovals, and polygons, specified by a list of object identifiers. The processes for applying operations to a range of text and to a set of polygons can differ greatly. The user interface typically includes a separate implementation for each operation for each data type. When a new data type is to be added to the application program, the user interface is updated to add an implementation for each operation. Accordingly, the flexibility and efficiency of such user interfaces are limited because the user interface does not apply operations in a type-independent manner.
In object oriented program architectures, such as the Microsoft(copyright) component object model (xe2x80x9cCOMxe2x80x9d) system or the Java programming language, objects encapsulate data and the operations performed on the data. This encapsulation allows for improved modularity over earlier procedural architectures, typified by the C programming language.
COM provides special objects referred to as xe2x80x9cCOM objectsxe2x80x9d. COM objects can be implemented in independent code modules or independent components. COM objects are different from objects in a generic object oriented programming sense, though such generic objects are used as building blocks for COM objects in a programming language such as C++. A COM program includes a collection of components defining COM objects. COM objects include interfaces. An interface abstractly defines a set of variables, and methods and functions implemented for the COM object. As abstract definitions, the actual implementations are separate from the interfaces. The interfaces provide a mechanism for a client program or object to invoke operations of the COM object. By definition, COM objects include several specific features, such as a xe2x80x9cquery interfacexe2x80x9d method to determine whether an operation is implemented for the COM object. Additional interfaces are defined and implemented to provide the functionality of the COM object. COM is described in many sources, including in Box, Don, xe2x80x9cEssential COMxe2x80x9d, Addison-Wesley Publishing Company, 1998.
The invention provides methods and apparatus implementing a technique for applying type-dependent implementations of type-independent operations to selected data through a user interface. In general, in one aspect, the technique includes receiving a selection of data having a type from a user through a user interface of a computer program running on a computer; recognizing the type of the selected data; and creating a specifier object according to the type, where the specifier object specifies an implementation of an operation. Thus, the implementation of the operation is separated from the user interface.
In another aspect, a computer program stored on a computer-readable medium embodies a user interface for binding operations to data. The user interface includes a plurality of types of data and defines at least one operation, where the operation is type-independent. The user interface also includes at least one implementation of the operation, where each implementation is type-dependent and corresponds to one of the types of data. The user interface includes a selection interface for selecting data. The selection interface, in response to a selection of data, generates a specifier object bound to the selected data, where the specifier object specifies an implementation of the operation corresponding to the type of the selected data
Advantages of the invention include one or more of the following. By removing the implementations of operations from the user interface, the user interface is simple and efficient. By separating selection and operations by data type, each data type can be addressed independently, providing for efficient program development.